package problem334;

//334.递增的三元子序列
//https://leetcode.cn/problems/increasing-triplet-subsequence/

class Solution {
    public boolean increasingTriplet(int[] nums) {
        int n = nums.length;
        int first = nums[0], secend = Integer.MAX_VALUE;
        for(int i = 1; i<n; i++) {
            if(nums[i] > secend) return true; 
            else if(nums[i] > first) secend = nums[i];
            else if(nums[i] < first) first = nums[i];
        }
        return false;
    }
}